package com.huawei.hwclouds.lubanops.demo.shopping.cart.biz.service;

import java.util.List;

import org.junit.Assert;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
import org.springframework.beans.factory.annotation.Autowired;

import com.huawei.hwclouds.lubanops.demo.shopping.cart.biz.BizAbstractJUnitTest;
import com.huawei.hwclouds.lubanops.demo.shopping.cart.biz.model.ShoppingCartsModel;

/**
 * @author y00438022
 * @since 2020/8/17
 **/
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class ShoppingCartServiceTest extends BizAbstractJUnitTest {

//    private static final String ak = System.currentTimeMillis() / 1000 + "";

    private static int id;

    @Autowired
    private ShoppingCartService shoppingCartService;

    @Test
    public void selectById() {
        ShoppingCartsModel model = shoppingCartService.retrieveById(1);
        Assert.assertTrue(model.getTitle() != null);
    }

    @Test
    public void add() {
        ShoppingCartsModel model = new ShoppingCartsModel();
        model.setImg("http://xxx");
        model.setMerchandiseId(2);
        model.setNum(1);
        model.setPrice(12.03);
        model.setShop("成都旗舰店");
        model.setUserId("1");
        model.setTitle("小牙膏");
        shoppingCartService.create(model);
        Assert.assertTrue(model.getTitle() != null);
    }

    @Test
    public void query() {
        List<ShoppingCartsModel> shoppingCartsModels = shoppingCartService.queryByUserId("1");
    }

}
